﻿namespace EasyWeb.Web.UI.Html
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web.Mvc;
    using System.Web.Mvc.Html;

    public static class EWHtmlHelperExtensions
    {
        public static EWHtmlHelper EasyWeb(this HtmlHelper helper)
        {
            EWGuard.IsNotNull(helper, "helper");

            return new EWHtmlHelper(helper);
        }

        public static EWGridBuilder<T> Grid<T>(this EWHtmlHelper helper, IEnumerable<T> dataSource)
        {
            EWGuard.IsNotNull(helper, "helper");

            return new EWGridBuilder<T>(new EWGrid<T>(helper.HtmlHelper.ViewContext)
            {
                DataSource = dataSource
            });
        }
    }
}
